from devtools import debug
from pydantic.v1 import (
    BaseModel as BaseModelV1,
    Field as FieldV1,
    ValidationError as ValidationErrorV1,
)

from pydantic import (
    BaseModel as BaseModelV2,
    Field as FieldV2,
    ValidationError as ValidationErrorV2,
)


class ModelV1(BaseModelV1):
    name: str = FieldV1(..., title="name", max_length=5)


class ModelV2(BaseModelV2):
    name: str = FieldV2(..., title="name", max_length=5)


def parse_e(exception) -> list[str]:
    code_2_template_zh


if __name__ == '__main__':

    try:
        ModelV1(name="hello1")

    except ValidationErrorV1 as e:
        debug(e.errors())

    try:
        ModelV2(name="hello1")

    except ValidationErrorV2 as e:
        debug(e.errors())